// pages/pro/pro.js
Page({
  data: {
    tactive:'undifine',
    qactive:"undifine",
    pactive:'undifine',
    mactive:'undifine',
    scrollTop:'',
    totop:'',
    active:0,
    lactive:'',
    top:0,
    toView:'',
    ad: ['../img/detail.jpg', '../img/detail.jpg', '../img/detail.jpg'],
    quote:'仅售226元！价值312元的4人自助午餐，提供免费WiFi。',
    name:'仅售226元！价值312元的4人自助午餐，提供免费WiFi。 ',
    mode:1,
    price:['0.00','26.80','24.00'],
    tuan: [{ name: '4人套餐48.8元', url: '../pro/pro?tuan=0' }, { name: '6人餐228元', url: '../pro/pro?tuan=1' }, { name: '短标4人餐188元（原价264元）', url: '../pro/pro?tuan=2' }, { name: '短标8人餐短标', url: '../pro/pro?tuan=3' }],
    quan: [{ name: '38元抵100元代金券', url: '../quan/quan?quan=0' }],
    pin: [{ name: '青椒肉丝炒饭10元短标', url: '../pin/pin?pin=0' }],
    mian: [{ name: '冰柠檬水免费赠饮一杯', url: '../mian/mian?mian=0' }, { name: '回锅肉炒饭一份短标', url: '../mian/mian?mian=1' }],
    lead: [{ name: '商家位置', to: 'obj1' }, { name: '套餐详情', to: 'obj2' }, { name: '购买须知', to: 'obj3' }, { name: '商家介绍', to: 'obj4' }],
    latitude: 40.002607,
    longitude: 116.487847,
    map:'../img/map.jpg',
    adress:'地址：九龙坡观音桥重庆市九龙坡区西郊路大洋百货4楼',
    phone:'156790-435',
    meal: [{ name: '小菜', num: '1', price: '30.00' }, { name: '小肉', num: '1', price: '30.00' },],
    know: [{ head: '有效期', name: '2017.6.1至2018.8.10（周末，法定节假日除外）' }, { head: '使用时间', name: '10:30-20:00' }, { head: '适用范围', name: '仅适用于菜品' },{ head: '使用规则', name: '一次仅限使用一张,无需预约' }],
    store:'介绍介绍介绍介绍介绍介绍介绍介绍介绍介绍',
    btn: [{ name: '立即抢购', url: '../deals/deals' }, { name: '赞助拼单', url: '../deal/deal?type=leader' }, { name: 'AA拼单', url: '../deal/deal?type=aa' }, { name: '发起博彩', url: '../deal/deal?type=rand' }]
  





  }, 
  scroll:function(e){
    var top=this.data.top;
    var that=this
    if(top!=0){
    if (e.detail.scrollTop > top){
      that.setData({
        lactive: 'active'
      })
    }else{
      that.setData({
        lactive: ''
      })
    }
    }
    if (e.detail.scrollTop>800){
      that.setData({
        totop: 'active'
      })
    }else{ 
      that.setData({
        totop: ''
      }) 
    }
  },
  scrollto:function(){
    this.setData({
      scrollTop: 0
    }) 
  },
  guide:function(){
    var that = this;
    wx.showModal({
      title: '提示',
      content: '确定要进入导航模式？',
      success: function (sm) {
        if (sm.confirm) {
          wx.openLocation({
            latitude: that.data.latitude,
            longitude: that.data.longitude,
            name: that.data.adress,
            scale: 14
          })  
        } else if (sm.cancel) {
        }
      }
    })
  },
  lead:function(e){
    let index = e.currentTarget.dataset.index;
    let to = e.currentTarget.dataset.to;
    this.setData({
      toView: to,
      active:index,
      top: this.data.top == 0 ? e.currentTarget.offsetTop : this.data.top
    })
  },
  onShareAppMessage: function () {
    return { title: this.data.name, path: '/pages/pro/pro' }
  }, 
  home:function(e){
    wx.switchTab({
      url: '../index/index',
    })
  },
  onLoad: function (options) {
  var that=this
  if (options.tuan){
   that.setData({ 
     tactive: options.tuan
   })
  }
  },
  onReady: function () {
 

  }
})